<?php

namespace App\Console\Crons;

use App\Models\Users;
use App\Services\FirstupService;

class SearchFirstupCron extends CronBase
{
    public function run($stime)
    {
        $end_time   = $stime + 86400;
        $start_time = $stime - 86400;
        $query = Users::whereRaw("create_time>={$start_time} AND create_time<{$end_time} AND firstup_id<1");

        $query->chunk(10000, function ($list) {
            foreach ($list as $user) {
                FirstupService::getInstance()->handleUserFirstup($user);
            }
        });
    }
}
